<%--
  Created by IntelliJ IDEA.
  User: chen3
  Date: 2021-08-15
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理后台</title>
    <link href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/layui/css/layui.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/jquery/jquery-3.3.1.js"></script>
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
    <script src="${pageContext.request.contextPath}/bootstrap/js/bootstrap.js"></script>
</head>
<body>

    <div class="layui-layout layui-layout-admin">
        <div class="layui-header layui-bg-red">
            <%@include file="/WEB-INF/jsp/header.jsp"%>
        </div>

        <div class="layui-side layui-bg-red">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree layui-bg-red" lay-filter="test">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a class="" href="javascript:;">商品管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:;" id="goodsList">商品列表</a></dd>
<%--                            <dd><a href="javascript:;">删除商品</a></dd>--%>
<%--                            <dd><a href="javascript:;">添加商品</a></dd>--%>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">订单管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:;" id="ordersList">订单列表</a></dd>
<%--                            <dd><a href="javascript:;">订单...</a></dd>--%>
                        </dl>
                    </li>
                    <li class="layui-nav-item"><a href="javascript:;" id="userList">用户角色管理</a></li>
                    <li class="layui-nav-item"><a href="javascript:;" id="classify">分类管理</a></li>
                    <li class="layui-nav-item"><a href="javascript:;" id="log">日志管理</a></li>
                </ul>
            </div>
        </div>

        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div style="padding: 15px;">
                <iframe id="content-iframe" src="" style="width: 100%;height: 100%;"></iframe>
            </div>
        </div>

        <div class="layui-footer">
            <!-- 底部固定区域 -->
            @果果商城
        </div>
    </div>
    <script>
        //JS
        layui.use(['element', 'layer', 'util'], function(){
            var element = layui.element
                ,layer = layui.layer
                ,util = layui.util
                ,$ = layui.$;

            element.on('nav(test)', function(elem){
                console.log(elem); //得到当前点击的DOM对象
                console.log(elem[0].id);
                const id = elem[0].id;
                if(id === "goodsList"){
                    $('#content-iframe').attr("src","${pageContext.request.contextPath}/shop/goods");
                }
                if(id === ""){
                    $('#content-iframe').attr("src","");
                }
                if(id === "ordersList"){
                    $('#content-iframe').attr("src","${pageContext.request.contextPath}/order/getAllByPage");
                }
                if(id === "classify"){
                    $('#content-iframe').attr("src","${pageContext.request.contextPath}/classify/home");
                }
                if(id === "log"){
                    $('#content-iframe').attr("src","${pageContext.request.contextPath}/log/getLogAll");
                }
                if(id === "userList"){
                    $('#content-iframe').attr("src","${pageContext.request.contextPath}/user/userlist");
                }

            });

        });
    </script>
</body>
</html>
